using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using CoachingOrganizer.Logic.Models.Tools.MoodLevel;
using CoachingOrganizer.iOS.Helpers;

namespace CoachingOrganizer.iOS.Controllers.Tools.MoodLevel
{
    public partial class MoodLevelViewController : UIViewController
    {
        private readonly MoodLevelModel _model;

        public MoodLevelViewController(MoodLevelModel model)
            : base("MoodLevelView", NSBundle.MainBundle)
        {
            _model = model;
        }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            //TitleView.Text = _model. //Label
            StartDateView.Date = _model.StartDate;   //DatePicker
            FinishDateView.Date = _model.FinishDate;  //DatePicker
            PeriodView.Date = DateTime.Today + _model.Period; //TimePicker ???
        }

        partial void ShowDetails(NSObject sender)
        {
            UIHelper.ShowDetailsStoryboad<MoodLevelDetailsViewController>("MoodLevelDetailsView", ParentViewController, c => c.HookModel(_model));
        }

		partial void SetStartDate (NSObject sender)
		{
			_model.StartDate = StartDateView.Date;
		}

		partial void SetFinishDate (NSObject sender)
		{
			_model.FinishDate = FinishDateView.Date;
		}

		partial void SetPeriod (NSObject sender)
		{
			_model.Period = ((DateTime)PeriodView.Date).TimeOfDay;
		}
    }
}